package cn.zhaozhiqi.remote.fallback;

import cn.zhaozhiqi.remote.api.IDriverFeignClient;
import cn.zhaozhiqi.remote.dto.DriverSummaryDto;
import cn.zhaozhiqi.result.JSONResult;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class DriverFeignClientFallbackFactory implements FallbackFactory<IDriverFeignClient> {
    @Override
    public IDriverFeignClient create(Throwable cause) {
        return new IDriverFeignClient() {
            @Override
            public JSONResult<DriverSummaryDto> getDriverSummery(Long id) {
                return JSONResult.error("查询司机今日投诉次数和今日取消订单数的服务不可达");
            }
        };
    }
}
